package com.ruanyun.modular.admin.controller;

import com.ruanyun.base.pojo.page.LayuiPageInfo;
import com.ruanyun.modular.admin.entity.TProposedMeasuresPlan;
import com.ruanyun.modular.admin.model.params.TProposedMeasuresPlanParam;
import com.ruanyun.modular.admin.model.result.TProposedMeasuresPlanResult;
import com.ruanyun.modular.admin.model.result.TProposedMeasuresPlanResults;
import com.ruanyun.modular.admin.service.TProposedMeasuresPlanService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 拟实施措施计划控制器
 *
 * @author zs
 * @Date 2021-04-19 16:23:37
 */
@Controller
@RequestMapping("/tProposedMeasuresPlan")
public class TProposedMeasuresPlanController extends BaseController {

    private String PREFIX = "/tProposedMeasuresPlan";

    @Autowired
    private TProposedMeasuresPlanService tProposedMeasuresPlanService;

    /**
     * 跳转到主页面
     *
     * @author zs
     * @Date 2021-04-19
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/tProposedMeasuresPlan.html";
    }

    /**
     * 新增页面
     *
     * @author zs
     * @Date 2021-04-19
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/tProposedMeasuresPlan_add.html";
    }

    /**
     * 编辑页面
     *
     * @author zs
     * @Date 2021-04-19
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/tProposedMeasuresPlan_edit.html";
    }

    /**
     * 新增接口
     *
     * @author zs
     * @Date 2021-04-19
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(TProposedMeasuresPlanParam tProposedMeasuresPlanParam) {
        return this.tProposedMeasuresPlanService.add(tProposedMeasuresPlanParam);
    }

    /**
     * 编辑接口
     *
     * @author zs
     * @Date 2021-04-19
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(TProposedMeasuresPlanParam tProposedMeasuresPlanParam) {
        return this.tProposedMeasuresPlanService.update(tProposedMeasuresPlanParam);
    }

    /**
     * 删除接口
     *
     * @author zs
     * @Date 2021-04-19
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(TProposedMeasuresPlanParam tProposedMeasuresPlanParam) {
        return this.tProposedMeasuresPlanService.updateDelFlagById((long)tProposedMeasuresPlanParam.getId());
    }

    /**
     * 查看详情接口
     *
     * @author zs
     * @Date 2021-04-19
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(TProposedMeasuresPlanParam tProposedMeasuresPlanParam) {
        TProposedMeasuresPlanResults detail = this.tProposedMeasuresPlanService.getDetail(tProposedMeasuresPlanParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author zs
     * @Date 2021-04-19
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(TProposedMeasuresPlanParam tProposedMeasuresPlanParam) {
        return this.tProposedMeasuresPlanService.findPageBySpec(tProposedMeasuresPlanParam);
    }

    /**
     * 启用
     *
     * @author zs
     * @Date 2021-04-19
     */
    @ResponseBody
    @RequestMapping("/enable")
    public ResponseData enable(@RequestParam Long id) {
        return this.tProposedMeasuresPlanService.enableById(id);
    }

    /**
     * 禁用
     *
     * @author zs
     * @Date 2021-04-19
     */
    @ResponseBody
    @RequestMapping("/disable")
    public ResponseData disable(@RequestParam Long id) {
        return this.tProposedMeasuresPlanService.disableById(id);
    }


    /**
     * 禁用
     *
     * @author zs
     * @Date 2021-04-19
     */
    @ResponseBody
    @RequestMapping("/commitReport")
    public ResponseData commitReport(@RequestParam Long companyId) {
        return this.tProposedMeasuresPlanService.commitReport(companyId);
    }


    /**
     * 减排措施描述
     *
     * @author zs
     * @Date 2021-05-13
     */
    @RequestMapping("/measureInfo")
    public String measureInfo() {
        return PREFIX + "/measureInfo.html";
    }

    /**
     * 台账计划描述
     *
     * @author zs
     * @Date 2021-05-13
     */
    @RequestMapping("/ledgerInfo")
    public String ledgerInfo() {
        return PREFIX + "/ledgerInfo.html";
    }



}


